import { handleActions } from 'redux-actions'
import {
  UPDATE_VERIFY_CODE_LOGIN_TYPE,
  INIT_VERIFY_CODE_LOGIN_TYPE
} from './type'

const Schema = {
  showEmpty: false,
  networkerror: false,
  mobile: '',
  mobileValid: false,
  mobileTip: '',
  code: '',
  codeTip: '',
  smsButtonClicked: false,
  smsButtonText: '获取验证码',
  smsTime: '',
  ruleChecked: true,
  nextCheck: false
}

export default handleActions(
  {
    [INIT_VERIFY_CODE_LOGIN_TYPE] (state, action) {
      return {
        ...Schema
      }
    },
    [UPDATE_VERIFY_CODE_LOGIN_TYPE] (state, action) {
      return {
        ...state,
        ...action.payload
      }
    }
  },
  Schema
)
